<html>
<head>
<title>AddTraktor</title>
<?php 
$db_connect=mysqli_connect("localhost","root","","tractors");
?>
</head>
<?php 
if(isset($_POST["submit"])){
$name=$_POST['name'];
$price=$_POST['price'];
$model=$_POST['model'];
$query1="INSERT INTO `tractor`( `name`, `model_id`, `price`) VALUES ('$name','$model','$price')";
mysqli_query($db_connect,$query1);
header("Location: index.php");

}
?>
<body>

<h1 align="center">Added Traktor</h1>
<form method="post">
<p>Name:<input name="name">
<p>Price:<input name="price" type="text"  ></p>
<p><input  type="file"  name="browse" value="browse"></p>

<select name="model">
<?php 
$query="Select modelname,model_id from model";
$result=mysqli_query($db_connect,$query) or die (mysqli_error($db_connect));

		while($row=mysqli_fetch_assoc($result))
{
	echo "<option value=\"".$row['model_id']."\">".$row['modelname']."</option>";
}
?>
</select><br>
<p align="right"> <input  type="submit" name="submit" value="OK"></p>
</form>

</body>
</html>